package com.itheima.apis.subject.controller.v1;

import com.car.model.common.dtos.ResponseResult;
import com.car.model.subject.dtos.FacilitatorDto;
import com.car.model.subject.pojos.Facilitator;
import com.itheima.apis.subject.FacilitatorControllerApi;
import com.itheima.apis.subject.service.FacilitatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/facilitator")
public class FacilitatorController implements FacilitatorControllerApi {

    @Autowired
    FacilitatorService facilitatorService;

    @PostMapping("/findPage")
    @Override
    public ResponseResult findByPage(FacilitatorDto dto) {
        return facilitatorService.findPage(dto);
    }

    @Override
    @PostMapping("/save")
    public ResponseResult save(@RequestBody Facilitator facilitator) {
        return facilitatorService.insert(facilitator);
    }

    @Override
    @PostMapping("/update")
    public ResponseResult update(@RequestBody Facilitator facilitator) {
        return facilitatorService.update(facilitator);
    }

}
